﻿// ----------------------------------------------------------------
// Description : 实体类,该文件由MyGeneration生成
// Author      : 
// Create date : 2010/4/19
// ----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace ITOMMS.Entity
{
	/// <summary>
	///	VwAsset Entity
	///	VwAsset Entity
	/// </summary>
	[Serializable]
	public class VwAssetEntity : BaseEntity<VwAssetEntity,int>
	{
		
		#region 私有成员			
		
		private int _ID; 
		private string _AssetNo; 
		private int? _customerID; 
		private int? _ClassID; 
		private int? _AssetState; 
		private string _AssetName; 
		private string _AssetUser; 
		private string _MadeName; 
		private string _SalerName; 
		private string _LinkMan; 
		private string _InvoiceNo; 
		private DateTime? _PurchaseDate; 
		private decimal? _PurchaseMoney; 
		private string _Principal; 
		private string _AssetDescription; 
		private DateTime? _CreateDate; 
		private int? _CreateBy; 
		private DateTime? _ModifyDate; 
		private int? _ModifyBy; 
		private string _Remarks; 
		private string _ClassName; 
		private string _StateName; 
		private string _ServiceName; 
		private string _ServiceTel; 
		private string _AssetModel; 
		private string _AssetVocation; 
		private string _Serial_number; 
		private string _Expand1; 
		private string _Expand2; 
		private string _Expand3; 
		private string _Expand4; 
		private string _Expand5; 
		private string _Expand6; 
		private string _Expand7; 
		private string _Expand8; 
		private string _Expand9; 
		private string _Expand10; 
		private string _Expand11; 
		private string _Expand12; 
		private string _Expand13; 
		private string _Expand15; 
		private string _Expand16; 
		private string _Expand14; 
		private string _Expand17; 
		private string _Expand18; 
		private string _Expand19; 
		private string _Expand20; 
		private string _Expand21; 
		private string _Expand22; 
		private string _Expand24; 
		private string _Expand25; 
		private string _Expand23; 
		private int _SEQNO;
		#endregion


		
		#region 默认( 空 ) 构造函数
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public VwAssetEntity()
		{
			_ID = 0; 
			_AssetNo = String.Empty; 
			_customerID =  null; 
			_ClassID =  null; 
			_AssetState =  null; 
			_AssetName = String.Empty; 
			_AssetUser = String.Empty; 
			_MadeName = String.Empty; 
			_SalerName = String.Empty; 
			_LinkMan = String.Empty; 
			_InvoiceNo = String.Empty; 
			_PurchaseDate =  null; 
			_PurchaseMoney =  null; 
			_Principal = String.Empty; 
			_AssetDescription = String.Empty; 
			_CreateDate =  null; 
			_CreateBy =  null; 
			_ModifyDate =  null; 
			_ModifyBy =  null; 
			_Remarks = String.Empty; 
			_ClassName = String.Empty; 
			_StateName = String.Empty; 
			_ServiceName = String.Empty; 
			_ServiceTel = String.Empty; 
			_AssetModel = String.Empty; 
			_AssetVocation = String.Empty; 
			_Serial_number = String.Empty; 
			_Expand1 = String.Empty; 
			_Expand2 = String.Empty; 
			_Expand3 = String.Empty; 
			_Expand4 = String.Empty; 
			_Expand5 = String.Empty; 
			_Expand6 = String.Empty; 
			_Expand7 = String.Empty; 
			_Expand8 = String.Empty; 
			_Expand9 = String.Empty; 
			_Expand10 = String.Empty; 
			_Expand11 = String.Empty; 
			_Expand12 = String.Empty; 
			_Expand13 = String.Empty; 
			_Expand15 = String.Empty; 
			_Expand16 = String.Empty; 
			_Expand14 = String.Empty; 
			_Expand17 = String.Empty; 
			_Expand18 = String.Empty; 
			_Expand19 = String.Empty; 
			_Expand20 = String.Empty; 
			_Expand21 = String.Empty; 
			_Expand22 = String.Empty; 
			_Expand24 = String.Empty; 
			_Expand25 = String.Empty; 
			_Expand23 = String.Empty; 
			_SEQNO = 0;
		}
		#endregion
		
		#region 属性值校验
		
		/// <summary>
		/// 属性值校验
		/// </summary>
		public bool CheckValues()
		{
			bool bResult = true;
			string strError = "";
		
			if ( _ID ==  0)
			{
				bResult = false;
				strError += "\r\n 非空值不能为: "+_ID;
			}
			
			if( !bResult )
					throw new ArgumentOutOfRangeException(strError);
			return bResult;
			
		}
		
		#endregion
		
		
		
	
		#region Required Fields Only Constructor
		
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public VwAssetEntity(
		int para_ID		)
		: this()
		{
					_ID = para_ID;
			_AssetNo = String.Empty;
			_customerID = null;
			_ClassID = null;
			_AssetState = null;
			_AssetName = String.Empty;
			_AssetUser = String.Empty;
			_MadeName = String.Empty;
			_SalerName = String.Empty;
			_LinkMan = String.Empty;
			_InvoiceNo = String.Empty;
			_PurchaseDate = null;
			_PurchaseMoney = null;
			_Principal = String.Empty;
			_AssetDescription = String.Empty;
			_CreateDate = null;
			_CreateBy = null;
			_ModifyDate = null;
			_ModifyBy = null;
			_Remarks = String.Empty;
			_ClassName = String.Empty;
			_StateName = String.Empty;
			_ServiceName = String.Empty;
			_ServiceTel = String.Empty;
			_AssetModel = String.Empty;
			_AssetVocation = String.Empty;
			_Serial_number = String.Empty;
			_Expand1 = String.Empty;
			_Expand2 = String.Empty;
			_Expand3 = String.Empty;
			_Expand4 = String.Empty;
			_Expand5 = String.Empty;
			_Expand6 = String.Empty;
			_Expand7 = String.Empty;
			_Expand8 = String.Empty;
			_Expand9 = String.Empty;
			_Expand10 = String.Empty;
			_Expand11 = String.Empty;
			_Expand12 = String.Empty;
			_Expand13 = String.Empty;
			_Expand15 = String.Empty;
			_Expand16 = String.Empty;
			_Expand14 = String.Empty;
			_Expand17 = String.Empty;
			_Expand18 = String.Empty;
			_Expand19 = String.Empty;
			_Expand20 = String.Empty;
			_Expand21 = String.Empty;
			_Expand22 = String.Empty;
			_Expand24 = String.Empty;
			_Expand25 = String.Empty;
			_Expand23 = String.Empty;
		}
		#endregion 

		
		#region 公有属性
			
			/// <summary>
			/// 行号，顺序号。系统默认的属性,对这个属性不要作操作.属性值在架构中已经处理
			/// </summary>
			public virtual int SEQNO
			{
				get { return _SEQNO; }
				set { _SEQNO = value; }
			}
		
			
		/// <summary>
		/// ID
		/// </summary>		
		public virtual int ID
		{
			get { return _ID; }
			set { _ID = value; }
		}
			
		/// <summary>
		/// AssetNo
		/// </summary>		
		public virtual string AssetNo
		{
			get { return _AssetNo; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for AssetNo", value, value.ToString());
				
				_AssetNo = value;
			}
		}
			
		/// <summary>
		/// customerID
		/// </summary>		
		public virtual int? customerID
		{
			get { return _customerID; }
			set { _customerID = value; }
		}
			
		/// <summary>
		/// ClassID
		/// </summary>		
		public virtual int? ClassID
		{
			get { return _ClassID; }
			set { _ClassID = value; }
		}
			
		/// <summary>
		/// AssetState
		/// </summary>		
		public virtual int? AssetState
		{
			get { return _AssetState; }
			set { _AssetState = value; }
		}
			
		/// <summary>
		/// AssetName
		/// </summary>		
		public virtual string AssetName
		{
			get { return _AssetName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for AssetName", value, value.ToString());
				
				_AssetName = value;
			}
		}
			
		/// <summary>
		/// AssetUser
		/// </summary>		
		public virtual string AssetUser
		{
			get { return _AssetUser; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for AssetUser", value, value.ToString());
				
				_AssetUser = value;
			}
		}
			
		/// <summary>
		/// MadeName
		/// </summary>		
		public virtual string MadeName
		{
			get { return _MadeName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for MadeName", value, value.ToString());
				
				_MadeName = value;
			}
		}
			
		/// <summary>
		/// SalerName
		/// </summary>		
		public virtual string SalerName
		{
			get { return _SalerName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for SalerName", value, value.ToString());
				
				_SalerName = value;
			}
		}
			
		/// <summary>
		/// LinkMan
		/// </summary>		
		public virtual string LinkMan
		{
			get { return _LinkMan; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for LinkMan", value, value.ToString());
				
				_LinkMan = value;
			}
		}
			
		/// <summary>
		/// InvoiceNo
		/// </summary>		
		public virtual string InvoiceNo
		{
			get { return _InvoiceNo; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for InvoiceNo", value, value.ToString());
				
				_InvoiceNo = value;
			}
		}
			
		/// <summary>
		/// PurchaseDate
		/// </summary>		
		public virtual DateTime? PurchaseDate
		{
			get { return _PurchaseDate; }
			set { _PurchaseDate = value; }
		}
			
		/// <summary>
		/// PurchaseMoney
		/// </summary>		
		public virtual decimal? PurchaseMoney
		{
			get { return _PurchaseMoney; }
			set { _PurchaseMoney = value; }
		}
			
		/// <summary>
		/// Principal
		/// </summary>		
		public virtual string Principal
		{
			get { return _Principal; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for Principal", value, value.ToString());
				
				_Principal = value;
			}
		}
			
		/// <summary>
		/// AssetDescription
		/// </summary>		
		public virtual string AssetDescription
		{
			get { return _AssetDescription; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 1000)
						throw new ArgumentOutOfRangeException("Invalid value for AssetDescription", value, value.ToString());
				
				_AssetDescription = value;
			}
		}
			
		/// <summary>
		/// CreateDate
		/// </summary>		
		public virtual DateTime? CreateDate
		{
			get { return _CreateDate; }
			set { _CreateDate = value; }
		}
			
		/// <summary>
		/// CreateBy
		/// </summary>		
		public virtual int? CreateBy
		{
			get { return _CreateBy; }
			set { _CreateBy = value; }
		}
			
		/// <summary>
		/// ModifyDate
		/// </summary>		
		public virtual DateTime? ModifyDate
		{
			get { return _ModifyDate; }
			set { _ModifyDate = value; }
		}
			
		/// <summary>
		/// ModifyBy
		/// </summary>		
		public virtual int? ModifyBy
		{
			get { return _ModifyBy; }
			set { _ModifyBy = value; }
		}
			
		/// <summary>
		/// Remarks
		/// </summary>		
		public virtual string Remarks
		{
			get { return _Remarks; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 100)
						throw new ArgumentOutOfRangeException("Invalid value for Remarks", value, value.ToString());
				
				_Remarks = value;
			}
		}
			
		/// <summary>
		/// ClassName
		/// </summary>		
		public virtual string ClassName
		{
			get { return _ClassName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for ClassName", value, value.ToString());
				
				_ClassName = value;
			}
		}
			
		/// <summary>
		/// StateName
		/// </summary>		
		public virtual string StateName
		{
			get { return _StateName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for StateName", value, value.ToString());
				
				_StateName = value;
			}
		}
			
		/// <summary>
		/// ServiceName
		/// </summary>		
		public virtual string ServiceName
		{
			get { return _ServiceName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 100)
						throw new ArgumentOutOfRangeException("Invalid value for ServiceName", value, value.ToString());
				
				_ServiceName = value;
			}
		}
			
		/// <summary>
		/// ServiceTel
		/// </summary>		
		public virtual string ServiceTel
		{
			get { return _ServiceTel; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for ServiceTel", value, value.ToString());
				
				_ServiceTel = value;
			}
		}
			
		/// <summary>
		/// AssetModel
		/// </summary>		
		public virtual string AssetModel
		{
			get { return _AssetModel; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for AssetModel", value, value.ToString());
				
				_AssetModel = value;
			}
		}
			
		/// <summary>
		/// AssetVocation
		/// </summary>		
		public virtual string AssetVocation
		{
			get { return _AssetVocation; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for AssetVocation", value, value.ToString());
				
				_AssetVocation = value;
			}
		}
			
		/// <summary>
		/// Serial_number
		/// </summary>		
		public virtual string Serial_number
		{
			get { return _Serial_number; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Serial_number", value, value.ToString());
				
				_Serial_number = value;
			}
		}
			
		/// <summary>
		/// Expand1
		/// </summary>		
		public virtual string Expand1
		{
			get { return _Expand1; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand1", value, value.ToString());
				
				_Expand1 = value;
			}
		}
			
		/// <summary>
		/// Expand2
		/// </summary>		
		public virtual string Expand2
		{
			get { return _Expand2; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand2", value, value.ToString());
				
				_Expand2 = value;
			}
		}
			
		/// <summary>
		/// Expand3
		/// </summary>		
		public virtual string Expand3
		{
			get { return _Expand3; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand3", value, value.ToString());
				
				_Expand3 = value;
			}
		}
			
		/// <summary>
		/// Expand4
		/// </summary>		
		public virtual string Expand4
		{
			get { return _Expand4; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand4", value, value.ToString());
				
				_Expand4 = value;
			}
		}
			
		/// <summary>
		/// Expand5
		/// </summary>		
		public virtual string Expand5
		{
			get { return _Expand5; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand5", value, value.ToString());
				
				_Expand5 = value;
			}
		}
			
		/// <summary>
		/// Expand6
		/// </summary>		
		public virtual string Expand6
		{
			get { return _Expand6; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand6", value, value.ToString());
				
				_Expand6 = value;
			}
		}
			
		/// <summary>
		/// Expand7
		/// </summary>		
		public virtual string Expand7
		{
			get { return _Expand7; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand7", value, value.ToString());
				
				_Expand7 = value;
			}
		}
			
		/// <summary>
		/// Expand8
		/// </summary>		
		public virtual string Expand8
		{
			get { return _Expand8; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand8", value, value.ToString());
				
				_Expand8 = value;
			}
		}
			
		/// <summary>
		/// Expand9
		/// </summary>		
		public virtual string Expand9
		{
			get { return _Expand9; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand9", value, value.ToString());
				
				_Expand9 = value;
			}
		}
			
		/// <summary>
		/// Expand10
		/// </summary>		
		public virtual string Expand10
		{
			get { return _Expand10; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand10", value, value.ToString());
				
				_Expand10 = value;
			}
		}
			
		/// <summary>
		/// Expand11
		/// </summary>		
		public virtual string Expand11
		{
			get { return _Expand11; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand11", value, value.ToString());
				
				_Expand11 = value;
			}
		}
			
		/// <summary>
		/// Expand12
		/// </summary>		
		public virtual string Expand12
		{
			get { return _Expand12; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand12", value, value.ToString());
				
				_Expand12 = value;
			}
		}
			
		/// <summary>
		/// Expand13
		/// </summary>		
		public virtual string Expand13
		{
			get { return _Expand13; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand13", value, value.ToString());
				
				_Expand13 = value;
			}
		}
			
		/// <summary>
		/// Expand15
		/// </summary>		
		public virtual string Expand15
		{
			get { return _Expand15; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand15", value, value.ToString());
				
				_Expand15 = value;
			}
		}
			
		/// <summary>
		/// Expand16
		/// </summary>		
		public virtual string Expand16
		{
			get { return _Expand16; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand16", value, value.ToString());
				
				_Expand16 = value;
			}
		}
			
		/// <summary>
		/// Expand14
		/// </summary>		
		public virtual string Expand14
		{
			get { return _Expand14; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand14", value, value.ToString());
				
				_Expand14 = value;
			}
		}
			
		/// <summary>
		/// Expand17
		/// </summary>		
		public virtual string Expand17
		{
			get { return _Expand17; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand17", value, value.ToString());
				
				_Expand17 = value;
			}
		}
			
		/// <summary>
		/// Expand18
		/// </summary>		
		public virtual string Expand18
		{
			get { return _Expand18; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand18", value, value.ToString());
				
				_Expand18 = value;
			}
		}
			
		/// <summary>
		/// Expand19
		/// </summary>		
		public virtual string Expand19
		{
			get { return _Expand19; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand19", value, value.ToString());
				
				_Expand19 = value;
			}
		}
			
		/// <summary>
		/// Expand20
		/// </summary>		
		public virtual string Expand20
		{
			get { return _Expand20; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand20", value, value.ToString());
				
				_Expand20 = value;
			}
		}
			
		/// <summary>
		/// Expand21
		/// </summary>		
		public virtual string Expand21
		{
			get { return _Expand21; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand21", value, value.ToString());
				
				_Expand21 = value;
			}
		}
			
		/// <summary>
		/// Expand22
		/// </summary>		
		public virtual string Expand22
		{
			get { return _Expand22; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand22", value, value.ToString());
				
				_Expand22 = value;
			}
		}
			
		/// <summary>
		/// Expand24
		/// </summary>		
		public virtual string Expand24
		{
			get { return _Expand24; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand24", value, value.ToString());
				
				_Expand24 = value;
			}
		}
			
		/// <summary>
		/// Expand25
		/// </summary>		
		public virtual string Expand25
		{
			get { return _Expand25; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand25", value, value.ToString());
				
				_Expand25 = value;
			}
		}
			
		/// <summary>
		/// Expand23
		/// </summary>		
		public virtual string Expand23
		{
			get { return _Expand23; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Expand23", value, value.ToString());
				
				_Expand23 = value;
			}
		}
			


		#endregion 	
		
		
        #region DAO操作
		
		
		/// <summary>
        /// 获取所有实体的列表
        /// </summary>
        /// <returns></returns>
        public override List<VwAssetEntity> GetAll()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[AssetNo],[customerID],[ClassID],[AssetState],[AssetName],[AssetUser],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[ClassName],[StateName],[ServiceName],[ServiceTel],[AssetModel],[AssetVocation],[Serial_number],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand15],[Expand16],[Expand14],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand24],[Expand25],[Expand23] from [Vw_Asset] ");
	
            List<VwAssetEntity> list = new List<VwAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = 0;
                while (dataReader.Read())
                {	seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([ID])  from [Vw_Asset] ");
	
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords(string sqlCondition)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([ID])  from [Vw_Asset]  ");
	
			 if (sqlCondition.Trim() != "")
            {
                strSql.Append(" where " + sqlCondition);
            }
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }	
		
		
		/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
        /// <returns></returns>
		 public override List<VwAssetEntity> GetAllByQuery(string strWhere, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [ID],[AssetNo],[customerID],[ClassID],[AssetState],[AssetName],[AssetUser],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[ClassName],[StateName],[ServiceName],[ServiceTel],[AssetModel],[AssetVocation],[Serial_number],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand15],[Expand16],[Expand14],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand24],[Expand25],[Expand23] from [Vw_Asset] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [ID] from [Vw_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere );
            }
			strSql.Append(" ) " );

            List<VwAssetEntity> list = new List<VwAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
			   int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
			/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
		/// <param name="strSort">ex:order by id desc</param>
        /// <returns></returns>
		 public override List<VwAssetEntity> GetAllByQuery(string strWhere,string strSort, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [ID],[AssetNo],[customerID],[ClassID],[AssetState],[AssetName],[AssetUser],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[ClassName],[StateName],[ServiceName],[ServiceTel],[AssetModel],[AssetVocation],[Serial_number],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand15],[Expand16],[Expand14],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand24],[Expand25],[Expand23] from [Vw_Asset] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [ID] from [Vw_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere+" " ).Append(strSort);
            }
			strSql.Append(" ) " ).Append(strSort);

            List<VwAssetEntity> list = new List<VwAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public override List<VwAssetEntity> GetAllByQuery(string strWhere)
        {
			strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[AssetNo],[customerID],[ClassID],[AssetState],[AssetName],[AssetUser],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[ClassName],[StateName],[ServiceName],[ServiceTel],[AssetModel],[AssetVocation],[Serial_number],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand15],[Expand16],[Expand14],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand24],[Expand25],[Expand23] from Vw_Asset ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<VwAssetEntity> list = new List<VwAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            { 
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
		/// <param name="parameters">sql条件中的参数</param>
        /// <returns></returns>
        public override List<VwAssetEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[AssetNo],[customerID],[ClassID],[AssetState],[AssetName],[AssetUser],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[ClassName],[StateName],[ServiceName],[ServiceTel],[AssetModel],[AssetVocation],[Serial_number],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand15],[Expand16],[Expand14],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand24],[Expand25],[Expand23] from [Vw_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<VwAssetEntity> list = new List<VwAssetEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
				int seq =0 ;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		

		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<VwAssetEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters, int rowNumber)
        {

            StringBuilder strSql = new StringBuilder();
			strSql.Append("select top ").Append(rowNumber).Append("  [ID],[AssetNo],[customerID],[ClassID],[AssetState],[AssetName],[AssetUser],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[ClassName],[StateName],[ServiceName],[ServiceTel],[AssetModel],[AssetVocation],[Serial_number],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand15],[Expand16],[Expand14],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand24],[Expand25],[Expand23] from [Vw_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<VwAssetEntity> list = new List<VwAssetEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {	
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句: AND AA=@AA</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<VwAssetEntity> GetAllByQuery(string strWhere, int rowNumber)
        {
		    strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			
			strSql.Append("select top ").Append(rowNumber).Append("  [ID],[AssetNo],[customerID],[ClassID],[AssetState],[AssetName],[AssetUser],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[ClassName],[StateName],[ServiceName],[ServiceTel],[AssetModel],[AssetVocation],[Serial_number],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand15],[Expand16],[Expand14],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand24],[Expand25],[Expand23] from [Vw_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where  " + strWhere);
            }
            List<VwAssetEntity> list = new List<VwAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq=0;
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		
		
			
		
		/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private VwAssetEntity ReaderBind(IDataReader dataReader,int seq)
        {
            ITOMMS.Entity.VwAssetEntity entity = new ITOMMS.Entity.VwAssetEntity();
			entity.SEQNO = seq;
            object obj;
						 obj=dataReader["ID"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ID= (int)obj;
			}
			 entity.AssetNo= dataReader["AssetNo"].ToString();
			 obj=dataReader["customerID"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.customerID= (int)obj;
			}
			 obj=dataReader["ClassID"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ClassID= (int)obj;
			}
			 obj=dataReader["AssetState"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.AssetState= (int)obj;
			}
			 entity.AssetName= dataReader["AssetName"].ToString();
			 entity.AssetUser= dataReader["AssetUser"].ToString();
			 entity.MadeName= dataReader["MadeName"].ToString();
			 entity.SalerName= dataReader["SalerName"].ToString();
			 entity.LinkMan= dataReader["LinkMan"].ToString();
			 entity.InvoiceNo= dataReader["InvoiceNo"].ToString();
			 obj=dataReader["PurchaseDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.PurchaseDate= (DateTime)obj;
			}
			 obj=dataReader["PurchaseMoney"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.PurchaseMoney= (decimal)obj;
			}
			 entity.Principal= dataReader["Principal"].ToString();
			 entity.AssetDescription= dataReader["AssetDescription"].ToString();
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}
			 obj=dataReader["CreateBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateBy= (int)obj;
			}
			 obj=dataReader["ModifyDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyDate= (DateTime)obj;
			}
			 obj=dataReader["ModifyBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyBy= (int)obj;
			}
			 entity.Remarks= dataReader["Remarks"].ToString();
			 entity.ClassName= dataReader["ClassName"].ToString();
			 entity.StateName= dataReader["StateName"].ToString();
			 entity.ServiceName= dataReader["ServiceName"].ToString();
			 entity.ServiceTel= dataReader["ServiceTel"].ToString();
			 entity.AssetModel= dataReader["AssetModel"].ToString();
			 entity.AssetVocation= dataReader["AssetVocation"].ToString();
			 entity.Serial_number= dataReader["Serial_number"].ToString();
			 entity.Expand1= dataReader["Expand1"].ToString();
			 entity.Expand2= dataReader["Expand2"].ToString();
			 entity.Expand3= dataReader["Expand3"].ToString();
			 entity.Expand4= dataReader["Expand4"].ToString();
			 entity.Expand5= dataReader["Expand5"].ToString();
			 entity.Expand6= dataReader["Expand6"].ToString();
			 entity.Expand7= dataReader["Expand7"].ToString();
			 entity.Expand8= dataReader["Expand8"].ToString();
			 entity.Expand9= dataReader["Expand9"].ToString();
			 entity.Expand10= dataReader["Expand10"].ToString();
			 entity.Expand11= dataReader["Expand11"].ToString();
			 entity.Expand12= dataReader["Expand12"].ToString();
			 entity.Expand13= dataReader["Expand13"].ToString();
			 entity.Expand15= dataReader["Expand15"].ToString();
			 entity.Expand16= dataReader["Expand16"].ToString();
			 entity.Expand14= dataReader["Expand14"].ToString();
			 entity.Expand17= dataReader["Expand17"].ToString();
			 entity.Expand18= dataReader["Expand18"].ToString();
			 entity.Expand19= dataReader["Expand19"].ToString();
			 entity.Expand20= dataReader["Expand20"].ToString();
			 entity.Expand21= dataReader["Expand21"].ToString();
			 entity.Expand22= dataReader["Expand22"].ToString();
			 entity.Expand24= dataReader["Expand24"].ToString();
			 entity.Expand25= dataReader["Expand25"].ToString();
			 entity.Expand23= dataReader["Expand23"].ToString();

            return entity;
        }
		
		
				/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private VwAssetEntity ReaderBind(IDataReader dataReader)
        {
            ITOMMS.Entity.VwAssetEntity entity = new ITOMMS.Entity.VwAssetEntity();
			object obj;
						 obj=dataReader["ID"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ID= (int)obj;
			}
			 entity.AssetNo= dataReader["AssetNo"].ToString();
			 obj=dataReader["customerID"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.customerID= (int)obj;
			}
			 obj=dataReader["ClassID"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ClassID= (int)obj;
			}
			 obj=dataReader["AssetState"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.AssetState= (int)obj;
			}
			 entity.AssetName= dataReader["AssetName"].ToString();
			 entity.AssetUser= dataReader["AssetUser"].ToString();
			 entity.MadeName= dataReader["MadeName"].ToString();
			 entity.SalerName= dataReader["SalerName"].ToString();
			 entity.LinkMan= dataReader["LinkMan"].ToString();
			 entity.InvoiceNo= dataReader["InvoiceNo"].ToString();
			 obj=dataReader["PurchaseDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.PurchaseDate= (DateTime)obj;
			}
			 obj=dataReader["PurchaseMoney"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.PurchaseMoney= (decimal)obj;
			}
			 entity.Principal= dataReader["Principal"].ToString();
			 entity.AssetDescription= dataReader["AssetDescription"].ToString();
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}
			 obj=dataReader["CreateBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateBy= (int)obj;
			}
			 obj=dataReader["ModifyDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyDate= (DateTime)obj;
			}
			 obj=dataReader["ModifyBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyBy= (int)obj;
			}
			 entity.Remarks= dataReader["Remarks"].ToString();
			 entity.ClassName= dataReader["ClassName"].ToString();
			 entity.StateName= dataReader["StateName"].ToString();
			 entity.ServiceName= dataReader["ServiceName"].ToString();
			 entity.ServiceTel= dataReader["ServiceTel"].ToString();
			 entity.AssetModel= dataReader["AssetModel"].ToString();
			 entity.AssetVocation= dataReader["AssetVocation"].ToString();
			 entity.Serial_number= dataReader["Serial_number"].ToString();
			 entity.Expand1= dataReader["Expand1"].ToString();
			 entity.Expand2= dataReader["Expand2"].ToString();
			 entity.Expand3= dataReader["Expand3"].ToString();
			 entity.Expand4= dataReader["Expand4"].ToString();
			 entity.Expand5= dataReader["Expand5"].ToString();
			 entity.Expand6= dataReader["Expand6"].ToString();
			 entity.Expand7= dataReader["Expand7"].ToString();
			 entity.Expand8= dataReader["Expand8"].ToString();
			 entity.Expand9= dataReader["Expand9"].ToString();
			 entity.Expand10= dataReader["Expand10"].ToString();
			 entity.Expand11= dataReader["Expand11"].ToString();
			 entity.Expand12= dataReader["Expand12"].ToString();
			 entity.Expand13= dataReader["Expand13"].ToString();
			 entity.Expand15= dataReader["Expand15"].ToString();
			 entity.Expand16= dataReader["Expand16"].ToString();
			 entity.Expand14= dataReader["Expand14"].ToString();
			 entity.Expand17= dataReader["Expand17"].ToString();
			 entity.Expand18= dataReader["Expand18"].ToString();
			 entity.Expand19= dataReader["Expand19"].ToString();
			 entity.Expand20= dataReader["Expand20"].ToString();
			 entity.Expand21= dataReader["Expand21"].ToString();
			 entity.Expand22= dataReader["Expand22"].ToString();
			 entity.Expand24= dataReader["Expand24"].ToString();
			 entity.Expand25= dataReader["Expand25"].ToString();
			 entity.Expand23= dataReader["Expand23"].ToString();

            return entity;
        }
		
		
		
		 #endregion
		
	}
}
